package com.xone.xapp;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;

public class ShareUtils {
	
	public static final String USERNAME = "uid";
	public static final String PASSWROR = "pid";
	
	/**
	 * 读取值
	 * @param key
	 * @param context
	 * @return
	 */
	public static String getPrefs(String key, Context context) {
		SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
		return sharedPrefs.getString(key, "");
	}
	
	/**
	 * 存入值
	 * @param key
	 * @param value
	 * @param context
	 */
	public static void setPrefs(String key, String value, Context context) {
		SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
		Editor editor = sharedPrefs.edit();
		editor.putString(key, value);
		editor.commit();
		
	}

}
